package com.ssy.lingxi.contract.config;

import com.ssy.lingxi.component.redis.lock.LockInfo;
import com.ssy.lingxi.component.redis.lock.LockTemplate;
import com.ssy.lingxi.contract.esign.token.EsignLock;

/**
 * esign锁
 * @author yzc
 * @version 2.0.0
 * @date 2021/7/24
 */
public class RedisEsignLock implements EsignLock {

    private final LockTemplate lockTemplate;

    public RedisEsignLock(LockTemplate lockTemplate) {
        this.lockTemplate = lockTemplate;
    }

    @Override
    public Object lock(String key) {
        return lockTemplate.lock(key);
    }

    @Override
    public boolean releaseLock(Object obj) {
        return lockTemplate.releaseLock((LockInfo) obj);
    }
}
